import request from "@/utils/request";

const BASE_URL = "/api/v1/clanMember";

const ClanMember = {
  /**
   * 申请加入宗亲会
   * @param {data} data 查询参数
   * @returns {Promise} 申请结果
   */
  apply(data: object) {
    return request({
      url: `${BASE_URL}/apply`,
      method: "POST",
      data: data,
    });
  },
  /**
   * 通过入会申请
   * status 2 拒绝  1通过
   */
  doAudit(params: { id: string; reason: string; status: number }) {
    return request({
      url: `${BASE_URL}/${params.id}/doAudit`,
      method: "POST",
      data: {
        reason: params.reason,
        status: params.status,
      },
    });
  },
  /**
   * 获取宗亲会成员详情
   */
  getClanPersonInfo(id: string) {
    return request({
      url: `${BASE_URL}/${id}/form`,
      method: "GET",
    });
  },
  /**
   * 族长加入宗亲会
   */
  addClanMember(data: object) {
    return request({
      url: `${BASE_URL}`,
      method: "POST",
      data: data,
    });
  },
  /**
   * 宗亲会员表审核分页列表
   */
  getClanMemberList(data: object) {
    return request({
      url: `${BASE_URL}/audit/page`,
      method: "GET",
      data: data,
    });
  },
  /**
   * 宗亲会成员列表
   */
  getClanList(data: object) {
    return request({
      url: `${BASE_URL}/page`,
      method: "GET",
      data: data,
    });
  },
  /**
   * 通过宗亲荟成员审核内容
   */
  checkClanAudit(params: { id: string; reason: string; status: number }) {
    return request({
      url: `${BASE_URL}/${params.id}/doAudit`,
      method: "POST",
      data: {
        reason: params.reason,
        status: params.status,
      },
    });
  },
};

export default ClanMember;
